exercise programs II

8.) Code the game hangman in REBOL.

9.) Make a function that acts like replace/all but for all files in a given directory and instead of accepting only one search/replacement pair this function should accept two blocks with search/replacement pairs.

10.) Complete the function so that it takes all files in the current directory with the specified file-type as their extension, sorts them by date and renames them to name-prefix followed by a four digit index starting at 1. If the refinement /offset is given, this should be the starting index.

Hint:

name-files: func [ file-type [file! string!]
                   name-prefix [file! string!]
                   /offset i [integer!] ][
  ...
]
		name-files ".jpg" "vacation"

11.) Add a /recursive refinement to list-dir.


12.) Write a script that recursively adds all files in a given directory to a compressed archive. Write an extraction program for this archive that requires the user to enter a password. Make sure the contents can not be read without the password and the password can not be obtained from the script.


13.) Write a script that downloads a whole website for offline browsing. Be careful to follow only href and src attributes that point to locations on the same server.

Hint:

get-hrefs: func [ markup /local urls url][
  urls: copy []
  parse markup [ any [
    thru "href=^"" copy url to "^"" (append urls url)
  ]]
  urls
]

last update: 15-Oct-2010/16:50:47+2:00
back to index